﻿using System;
using Pantry.Business;
using Pantry.Entity;

namespace Pantry.Web.Users
{
    public partial class ForgotPassword : System.Web.UI.Page
    {
        private AccountBus _accountBus;
        private User _user;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButtonChangePasswordClick(object sender, EventArgs e)
        {
            _accountBus = new AccountBus();
            _user = new User
                        {
                            UserName = TextboxUserName.Text.Trim(), 
                            Password = null, Email = TextboxEmail.Text.Trim()
                        };
            if (_accountBus.ChangePassword(_user))
            {
                _accountBus.ChangePassword(_user);
                //Account.SendMail(TextboxEmail.Text);
                Response.Redirect("LogOn.aspx");
            }
            LabelErrorChangePassword.Text = "UserName or Email Invalid";
        }
    }
}
